package com.oj.friend.controller.file;

import com.oj.common.core.domain.R;
import com.oj.common.file.domain.OSSResult;
import com.oj.common.file.service.OssService;
import com.oj.friend.service.impl.FileServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Description
 * @Author bin
 * @Date 2025/6/13
 */
@RestController
@RequestMapping("/file")
public class FileController {

    @Resource
    private FileServiceImpl fileService;

    @PostMapping("/upload")
    public R<OSSResult> uploadFile(MultipartFile file) throws Exception {
        // 上传文件
        return R.ok(fileService.uploadFile(file));
    }
}
